﻿namespace PMS.Client.FrmUserPositionLevel
{
    using PMS.BLL;
    using PMS.Client.Controls;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class FrmPositionLevelLogList : Form
    {
        private ToolStripButton btnCheck;
        private ToolStripButton btnDelete;
        private IContainer components = null;
        private UCDataGridView dataGridView1;
        private DataGridViewTextBoxColumn IsDoublePosition;
        private DataGridViewTextBoxColumn IUserName;
        private DataGridViewTextBoxColumn JobTitle1;
        private DataGridViewTextBoxColumn JobTitle2;
        private Label lbTitle;
        private UserChangeLogBLL logbll = new UserChangeLogBLL();
        private DataGridViewTextBoxColumn LogID;
        private DataGridViewTextBoxColumn LogType;
        private DataGridViewTextBoxColumn Position1;
        private DataGridViewTextBoxColumn Position2;
        private DataGridViewTextBoxColumn PositionEndDate1;
        private DataGridViewTextBoxColumn PositionEndDate2;
        private DataGridViewTextBoxColumn PositionLevel1;
        private DataGridViewTextBoxColumn PositionLevel2;
        private DataGridViewTextBoxColumn PositionNo1;
        private DataGridViewTextBoxColumn PositionNo2;
        private DataGridViewTextBoxColumn PositionRemark1;
        private DataGridViewTextBoxColumn PositionRemark2;
        private DataGridViewTextBoxColumn PositionStartDate1;
        private DataGridViewTextBoxColumn PositionStartDate2;
        private ToolStrip toolStrip1;

        public FrmPositionLevelLogList()
        {
            this.InitializeComponent();
            this.dataGridView1.AutoGenerateColumns = false;
            this.DataGridBind();
        }

        private void btnCheck_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count <= 0)
            {
                MessageBox.Show("请选择要审核的记录！");
            }
            else
            {
                FrmPositionLevelLogCheck check = new FrmPositionLevelLogCheck(int.Parse(this.dataGridView1.SelectedRows[0].Cells["LogID"].Value.ToString()));
                check.ShowDialog();
                if (check.DialogResult == DialogResult.OK)
                {
                    this.DataGridBind();
                }
            }
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count <= 0)
            {
                MessageBox.Show("请选择要审核的记录！");
            }
            else if (MessageBox.Show("确定删除？", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
            {
                int logID = int.Parse(this.dataGridView1.SelectedRows[0].Cells["LogID"].Value.ToString());
                if (this.logbll.Delete(logID))
                {
                    SyslogBLL.Write("审核用户信息", "删除用户定岗记录");
                    this.DataGridBind();
                }
                else
                {
                    MessageBox.Show("删除失败！");
                }
            }
        }

        private void DataGridBind()
        {
            this.dataGridView1.DataSource = this.logbll.GetList(" AND LogType='定岗'");
        }

        private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.ColumnIndex == 10)
            {
                if (e.Value.ToString() == "1")
                {
                    e.Value = "是";
                }
                else
                {
                    e.Value = "否";
                }
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(FrmPositionLevelLogList));
            DataGridViewCellStyle style = new DataGridViewCellStyle();
            this.toolStrip1 = new ToolStrip();
            this.btnCheck = new ToolStripButton();
            this.btnDelete = new ToolStripButton();
            this.dataGridView1 = new UCDataGridView(this.components);
            this.LogID = new DataGridViewTextBoxColumn();
            this.IUserName = new DataGridViewTextBoxColumn();
            this.LogType = new DataGridViewTextBoxColumn();
            this.JobTitle1 = new DataGridViewTextBoxColumn();
            this.PositionLevel1 = new DataGridViewTextBoxColumn();
            this.Position1 = new DataGridViewTextBoxColumn();
            this.PositionNo1 = new DataGridViewTextBoxColumn();
            this.PositionRemark1 = new DataGridViewTextBoxColumn();
            this.PositionStartDate1 = new DataGridViewTextBoxColumn();
            this.PositionEndDate1 = new DataGridViewTextBoxColumn();
            this.IsDoublePosition = new DataGridViewTextBoxColumn();
            this.JobTitle2 = new DataGridViewTextBoxColumn();
            this.Position2 = new DataGridViewTextBoxColumn();
            this.PositionLevel2 = new DataGridViewTextBoxColumn();
            this.PositionNo2 = new DataGridViewTextBoxColumn();
            this.PositionRemark2 = new DataGridViewTextBoxColumn();
            this.PositionStartDate2 = new DataGridViewTextBoxColumn();
            this.PositionEndDate2 = new DataGridViewTextBoxColumn();
            this.lbTitle = new Label();
            this.toolStrip1.SuspendLayout();
            ((ISupportInitialize) this.dataGridView1).BeginInit();
            base.SuspendLayout();
            this.toolStrip1.Items.AddRange(new ToolStripItem[] { this.btnCheck, this.btnDelete });
            this.toolStrip1.Location = new Point(0, 0x1f);
            this.toolStrip1.Name = "toolStrip1";
            this.toolStrip1.RenderMode = ToolStripRenderMode.System;
            this.toolStrip1.Size = new Size(0x3cb, 0x36);
            this.toolStrip1.TabIndex = 0x13;
            this.toolStrip1.Text = "toolStrip1";
            this.btnCheck.Image = (Image) manager.GetObject("btnCheck.Image");
            this.btnCheck.ImageScaling = ToolStripItemImageScaling.None;
            this.btnCheck.ImageTransparentColor = Color.Magenta;
            this.btnCheck.Name = "btnCheck";
            this.btnCheck.Size = new Size(0x24, 0x33);
            this.btnCheck.Text = "审批";
            this.btnCheck.TextImageRelation = TextImageRelation.ImageAboveText;
            this.btnCheck.Click += new EventHandler(this.btnCheck_Click);
            this.btnDelete.Image = (Image) manager.GetObject("btnDelete.Image");
            this.btnDelete.ImageScaling = ToolStripItemImageScaling.None;
            this.btnDelete.ImageTransparentColor = Color.Magenta;
            this.btnDelete.Name = "btnDelete";
            this.btnDelete.Size = new Size(0x24, 0x33);
            this.btnDelete.Text = "删除";
            this.btnDelete.TextImageRelation = TextImageRelation.ImageAboveText;
            this.btnDelete.Click += new EventHandler(this.btnDelete_Click);
            this.dataGridView1.AllowUserToAddRows = false;
            this.dataGridView1.AllowUserToDeleteRows = false;
            this.dataGridView1.AllowUserToResizeRows = false;
            this.dataGridView1.BackgroundColor = Color.FromArgb(0xa4, 0xc4, 0xeb);
            this.dataGridView1.BorderStyle = BorderStyle.None;
            this.dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            this.dataGridView1.Columns.AddRange(new DataGridViewColumn[] { 
                this.LogID, this.IUserName, this.LogType, this.JobTitle1, this.PositionLevel1, this.Position1, this.PositionNo1, this.PositionRemark1, this.PositionStartDate1, this.PositionEndDate1, this.IsDoublePosition, this.JobTitle2, this.Position2, this.PositionLevel2, this.PositionNo2, this.PositionRemark2, 
                this.PositionStartDate2, this.PositionEndDate2
             });
            style.Alignment = DataGridViewContentAlignment.MiddleLeft;
            style.BackColor = Color.FromArgb(0xd9, 0xea, 0xf7);
            style.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style.ForeColor = SystemColors.ControlText;
            style.SelectionBackColor = SystemColors.Highlight;
            style.SelectionForeColor = SystemColors.ControlText;
            style.WrapMode = DataGridViewTriState.False;
            this.dataGridView1.DefaultCellStyle = style;
            this.dataGridView1.Dock = DockStyle.Fill;
            this.dataGridView1.EnableHeadersVisualStyles = false;
            this.dataGridView1.GridColor = Color.FromArgb(0xd0, 0xd7, 0xe5);
            this.dataGridView1.HighlightSelectedColumnHeaders = false;
            this.dataGridView1.Location = new Point(0, 0x55);
            this.dataGridView1.MultiSelect = false;
            this.dataGridView1.Name = "dataGridView1";
            this.dataGridView1.ReadOnly = true;
            this.dataGridView1.RowTemplate.Height = 0x17;
            this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            this.dataGridView1.Size = new Size(0x3cb, 0x182);
            this.dataGridView1.TabIndex = 20;
            this.dataGridView1.CellFormatting += new DataGridViewCellFormattingEventHandler(this.dataGridView1_CellFormatting);
            this.LogID.DataPropertyName = "LogID";
            this.LogID.HeaderText = "ID";
            this.LogID.Name = "LogID";
            this.LogID.ReadOnly = true;
            this.LogID.Visible = false;
            this.LogID.Width = 50;
            this.IUserName.DataPropertyName = "IUserName";
            this.IUserName.HeaderText = "姓名";
            this.IUserName.Name = "IUserName";
            this.IUserName.ReadOnly = true;
            this.LogType.DataPropertyName = "LogType";
            this.LogType.HeaderText = "日志类型";
            this.LogType.Name = "LogType";
            this.LogType.ReadOnly = true;
            this.JobTitle1.DataPropertyName = "JobTitle1";
            this.JobTitle1.HeaderText = "岗位1名称";
            this.JobTitle1.Name = "JobTitle1";
            this.JobTitle1.ReadOnly = true;
            this.PositionLevel1.DataPropertyName = "PositionLevel1";
            this.PositionLevel1.HeaderText = "岗位1等级";
            this.PositionLevel1.Name = "PositionLevel1";
            this.PositionLevel1.ReadOnly = true;
            this.Position1.DataPropertyName = "Position1";
            this.Position1.HeaderText = "岗位1类别";
            this.Position1.Name = "Position1";
            this.Position1.ReadOnly = true;
            this.PositionNo1.DataPropertyName = "PositionNo1";
            this.PositionNo1.HeaderText = "岗位1文号";
            this.PositionNo1.Name = "PositionNo1";
            this.PositionNo1.ReadOnly = true;
            this.PositionNo1.Width = 120;
            this.PositionRemark1.DataPropertyName = "PositionRemark1";
            this.PositionRemark1.HeaderText = "岗位1文件摘要";
            this.PositionRemark1.Name = "PositionRemark1";
            this.PositionRemark1.ReadOnly = true;
            this.PositionRemark1.Width = 120;
            this.PositionStartDate1.DataPropertyName = "PositionStartDate1";
            this.PositionStartDate1.HeaderText = "岗位1起骋时间";
            this.PositionStartDate1.Name = "PositionStartDate1";
            this.PositionStartDate1.ReadOnly = true;
            this.PositionStartDate1.Width = 120;
            this.PositionEndDate1.DataPropertyName = "PositionEndDate1";
            this.PositionEndDate1.HeaderText = "岗位1止骋时间";
            this.PositionEndDate1.Name = "PositionEndDate1";
            this.PositionEndDate1.ReadOnly = true;
            this.PositionEndDate1.Width = 120;
            this.IsDoublePosition.DataPropertyName = "IsDoublePosition";
            this.IsDoublePosition.HeaderText = "是否双肩挑";
            this.IsDoublePosition.Name = "IsDoublePosition";
            this.IsDoublePosition.ReadOnly = true;
            this.JobTitle2.DataPropertyName = "JobTitle2";
            this.JobTitle2.HeaderText = "岗位2名称";
            this.JobTitle2.Name = "JobTitle2";
            this.JobTitle2.ReadOnly = true;
            this.Position2.DataPropertyName = "Position2";
            this.Position2.HeaderText = "岗位2类别";
            this.Position2.Name = "Position2";
            this.Position2.ReadOnly = true;
            this.PositionLevel2.DataPropertyName = "PositionLevel2";
            this.PositionLevel2.HeaderText = "岗位2等级";
            this.PositionLevel2.Name = "PositionLevel2";
            this.PositionLevel2.ReadOnly = true;
            this.PositionNo2.DataPropertyName = "PositionNo2";
            this.PositionNo2.HeaderText = "岗位2文号";
            this.PositionNo2.Name = "PositionNo2";
            this.PositionNo2.ReadOnly = true;
            this.PositionRemark2.DataPropertyName = "PositionRemark2";
            this.PositionRemark2.HeaderText = "岗位2文件摘要";
            this.PositionRemark2.Name = "PositionRemark2";
            this.PositionRemark2.ReadOnly = true;
            this.PositionRemark2.Width = 120;
            this.PositionStartDate2.DataPropertyName = "PositionStartDate2";
            this.PositionStartDate2.HeaderText = "岗位2起骋时间";
            this.PositionStartDate2.Name = "PositionStartDate2";
            this.PositionStartDate2.ReadOnly = true;
            this.PositionStartDate2.Width = 120;
            this.PositionEndDate2.DataPropertyName = "PositionEndDate2";
            this.PositionEndDate2.HeaderText = "岗位2止骋时间";
            this.PositionEndDate2.Name = "PositionEndDate2";
            this.PositionEndDate2.ReadOnly = true;
            this.PositionEndDate2.Width = 120;
            this.lbTitle.BackColor = Color.Gold;
            this.lbTitle.Dock = DockStyle.Top;
            this.lbTitle.Font = new Font("宋体", 14.25f, FontStyle.Bold, GraphicsUnit.Point, 0x86);
            this.lbTitle.ForeColor = Color.Black;
            this.lbTitle.Location = new Point(0, 0);
            this.lbTitle.Name = "lbTitle";
            this.lbTitle.Size = new Size(0x3cb, 0x1f);
            this.lbTitle.TabIndex = 0x37;
            this.lbTitle.Text = "人员定岗审核";
            this.lbTitle.TextAlign = ContentAlignment.MiddleCenter;
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x3cb, 0x1d7);
            base.Controls.Add(this.dataGridView1);
            base.Controls.Add(this.toolStrip1);
            base.Controls.Add(this.lbTitle);
            base.Icon = (Icon) manager.GetObject("$this.Icon");
            base.Name = "FrmPositionLevelLogList";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "定岗审核";
            this.toolStrip1.ResumeLayout(false);
            this.toolStrip1.PerformLayout();
            ((ISupportInitialize) this.dataGridView1).EndInit();
            base.ResumeLayout(false);
            base.PerformLayout();
        }
    }
}

